repo.or.cz
/
and.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
10261 - Ferry loading (DP, programación dinámica) && 410 - Station balance (Dijkstra...
[and.git]
/
11335 - Discrete pursuit
/
11335.cpp
blob
21be3f6578ed9bd4bda59df2b02a51dbde261515
1
#include <iostream>
2
3
using namespace
std
;
4
5
int
main
(){
6
unsigned int
a
,
u
,
v
;
7
while
(
cin
>>
a
>>
u
>>
v
){
8
if
(
a
==
0
){
9
cout
<<
"0"
<<
endl
;
10
}
else
{
11
unsigned int
min
,
px
,
lx
,
py
,
ly
,
t
;
12
px
=
0
;
13
lx
=
a
;
14
t
=
0
;
15
while
(
px
<
lx
){
16
px
= (
t
*(
t
+
1
))/
2
;
17
lx
=
a
+
u
*
t
;
18
++
t
;
19
}
20
--
t
;
21
min
=
t
;
22
23
py
=
ly
=
0
;
24
t
=
1
;
25
while
(
py
<
ly
){
26
py
= (
t
*(
t
+
1
))/
2
;
27
ly
=
v
*
t
;
28
++
t
;
29
}
30
--
t
;
31
32
if
(
t
>
min
)
min
=
t
;
33
cout
<<
min
<<
endl
;
34
}
35
}
36
return
0
;
37
}